<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>ajax 跨域</title>
   <script src="../../../js/jquery-1.11.3.js"></script>
   <style>
      body {
         margin: 1rem;
      }
   </style>
</head>

<body>
   <button class="btn btn-success">ajax 提交</button> <br>
   <h3></h3>
   <script>
      $(".btn-success").click(function () {
         $.ajax({
            url: "http://localhost:3000/",
            type: "get",
            dataType:'json',
            success: function (result) {
               console.log(result);
               $("h3").html(result.name)
            },
            error: function (err) {
               console.log("error");
            }
         });
      });
   </script>
</body>

</html>